package com.dataseek.iot.mysql.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dataseek.iot.mysql.entity.MqttAccount;
import com.dataseek.iot.mysql.mapper.MqttAccountMapper;
import com.dataseek.iot.mysql.service.IMqttAccountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cc
 * @since 2021-11-13
 */
@Service
public class MqttAccountServiceImpl extends ServiceImpl<MqttAccountMapper, MqttAccount> implements IMqttAccountService {


    /**
     * 根据设备编码获取账号
     * @param code
     * @return
     */
    public MqttAccount getAccountByDeviceCode(String code){
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("device_code", code);
        return this.getOne(wrapper);
    }
}
